﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class admin_members_profile : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (String.IsNullOrEmpty(Request.QueryString["id"])){

        }else{
            string id = Request.QueryString["id"];
            HyperLink1.NavigateUrl = "~/admin/members/edit-member.aspx?id=" + id;
            Member m = ACSService.getMember(Convert.ToInt32(id));

            if (m != null)
            {
                fnameBox.Text = m.FirstName;
                lnameBox.Text = m.LastName;
                emailBox.Text = m.Email;
                phoneBox.Text = m.Phone;
                studentBox.Text = m.StudentID;
                uniList.SelectedValue = Convert.ToString(m.University.ID);
                sbjBox.Text = m.SubjectArea;
                yearBox.Text = m.YearOfStudy;
                degreeBox.Text = m.DegreeType;
                careerBox.Text = m.CareerInterest;
                genderBox.Text = m.Gender;
                ethnicityBox.Text = m.Ethnicity;
                //citizenList.SelectedValue = m.UkCitizen? "true":"false";
                ageBox.Text = m.AgeGroup;

            }
            else
            {
                //redirect to members
            }
        }
    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        int id = int.Parse(Request.QueryString["id"].ToString());

        ACSService.deleteMember(id);
        Response.Redirect("members.aspx");
    }
}